(deftemplate animale
    (slot nume)
    (slot mediuViata)
    (slot modViata)
    (slot regimAlimentar)
    (slot zona)
    (slot mancatorDE)
    (slot mancatDE)
)

(assert (animale (nume urs)(mediuViata semiacvatic)(modViata diurn)(regimAlimentar omnivor)
    (zona polara)(mancatorDE foca)(mancatDE tigru)))


(assert (animale (nume foca)(mediuViata acvatic)(modViata diurn)(regimAlimentar omnivor)
    (zona polara)(mancatorDE pesti)(mancatDE urs)))

(assert (animale (nume broasca)(mediuViata semiacvatic)(modViata diurn)(regimAlimentar ierbivor)
    (zona mediteraneana)(mancatorDE alge)(mancatDE sarpe)))


(assert (animale (nume oaie)(mediuViata terestru)(modViata diurn)(regimAlimentar omnivor)
    (zona balcanica)(mancatorDE iarba)(mancatDE lup)))


(assert (animale (nume lup)(mediuViata terestru)(modViata diurn)(regimAlimentar carnivor)
    (zona mediteraneana)(mancatorDE capre)(mancatDE leu)))


(assert (animale (nume tigru)(mediuViata terestru)(modViata diurn)(regimAlimentar carnivor)
    (zona deserturilor)(mancatorDE lupi)(mancatDE leu)))

(assert (animale (nume pisica)(mediuViata terestru)(modViata diurn)(regimAlimentar omnivor)
    (zona mediteraneana)(mancatorDE lapte)(mancatDE tigru)))



(printout t crlf "       >>> GRADINA ZOOLOGICA <<<      "crlf)

(defrule q1
    (declare (salience 31))
    (animale (nume ?n)(mediuViata semiacvatic))
    
    => 
    (printout t "Animalul " ?n " traieste intr-un mediu semiacvatic." crlf)
 )

(printout t crlf)
(run)


(defrule q2
    (declare (salience 22))
    (animale (nume ?n)(regimAlimentar ierbivor)(zona mediteraneana))
    
    => 
    (printout t "Animalul " ?n " este ierbivor si traieste intr-un zona mediteraneana." crlf)
 )
(printout t crlf)
(run)



(defrule q3
    (declare (salience 6))
    (animale (nume ?n)(mancatDE ?x))
        
    => 
    (printout t "(" ?x ", " ?n ")"crlf)
 )

(printout t crlf)
(run)


(defrule q4
    (declare (salience 5))
    (animale (nume ?n)(zona ?z &~mediteraneana &~deserturilor &~balcanica) )
        
    => 
    (printout t "Animalul " ?n " traieste intr-o zona polara" crlf)
 )

(facts)
(printout t  crlf)
(run)